package com.kayo.specimen.controller;

import com.kayo.specimen.model.User;
import com.kayo.specimen.model.view.UserView;
import com.kayo.specimen.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private UserService userService;

    @ResponseBody
    @RequestMapping("/say")
    public ModelAndView say(String name) {
        List<UserView> users = userService.getUsers(null, null,null,null);

        Logger logger= LoggerFactory.getLogger(getClass());
        logger.debug("test========say=========="+name);
        logger.error("========name=======");

        ModelAndView modelAndView=new ModelAndView("");
        modelAndView.addObject("users",users);
        return modelAndView;
    }
}
